<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateSkinRecordBonusesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('skin_record_bonuses', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('bonusable_id')->comment('被发放人的ID');
			$table->string('bonusable_type', 30)->comment('StoreAdmin / WechatUser');
			$table->decimal('amount', 5)->comment('发放的金额 1 - 10');
			$table->integer('skin_record_id')->comment('对应的测肤ID');
			$table->boolean('pay_type')->comment('支付渠道 1 微信 2 支付宝');
			$table->string('biz_no', 50)->comment('流水号');
			$table->text('data', 65535)->nullable()->comment('调用API发放后JSON数据');
			$table->boolean('bonus_status')->default(0)->comment('发放金额的状态  0 未发放， 1 成功 ，2 失败');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('skin_record_bonuses');
	}

}
